<!--  -->
<template>
<div class='list-page'>
        <div class="flex" v-if="tabShow">
            <div v-for="(value,index) in tabsData" :key="index" class="title-box" @click="changeTabs(index,value)">
                <div class="top-title">{{value.title}}</div>
                <div :class="changeIndex==index?'active':'bottom-desc'">{{value.desc}}</div>
            </div>
        </div>
        <!-- 商品列表 -->
         <div class="flex-wrap" :class="flag?'shop-bt-box-h':'shop-bt-box-h1'" v-if="goodlistFlag">
            <div class="shop-bt-box" @click="gotoDetail(value.goods_id)" v-for="value in homeList" :key="value.goods_id">
                <img :src="value.goods_thumb" alt="">
                <div>
                <div class="shop-desc">{{value.goods_name}}</div>
                <div class="shop-price">{{value.market_price_formated}}</div>
                </div>
            </div>
        </div>
        <div class="flex-wrap" :class="flag?'shop-bt-box-h':'shop-bt-box-h1'" v-else>
            <div class="shop-bt-box" @click="gotoDetail(value.goods_id)" v-for="value in homeList" :key="value.goods_id">
                <img :src="value.goods_img" alt="">
                <div>
                <div class="shop-desc">{{value.title}}</div>
                <div class="shop-price">{{value.market_price_formated}}</div>
                </div>
            </div>
        </div>
</div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';

export default {
//import引入的组件需要注入到对象中才能使用
components: {},
data() {
//这里存放数据
return {
   
    changeIndex:'',
};

},
props:['tabShow','flag','tabsData','homeList','goodlistFlag'],
//监听属性 类似于data概念
computed: {
    // homeListNew(){
    //     return this.$store.state.goodList
    // }
},
//监控data中的数据变化
watch: {},
//方法集合
methods: {
    changeTabs(index,value){
        console.log('index',index)
        this.changeIndex = index;
        this.$emit('changetab',value)
    },
    gotoDetail(id){
        this.$router.push({
            name:'goodsDetail',
            params:{
                goods_id:id
            }
            })
    }
},
beforeCreate() {}, //生命周期 - 创建之前
//生命周期 - 创建完成（可以访问当前this实例）
created() {

},
beforeMount() {}, //生命周期 - 挂载之前
//生命周期 - 挂载完成（可以访问DOM元素）
mounted() {
 console.log('homeList',this.homeList)

},
beforeUpdate() {}, //生命周期 - 更新之前
updated() {}, //生命周期 - 更新之后
beforeDestroy() {}, //生命周期 - 销毁之前
destroyed() {}, //生命周期 - 销毁完成
activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang="less" scoped>
.list-page{
    .title-box{
        
            border-right:1px solid #999;
            flex:1;
            text-align: center;
        .top-title{
        font-size: 1.6rem;
        color:#333;
        margin-bottom:0.2rem;
    }
    .bottom-desc{
        font-size: 1.2rem;
        color: #888;
    }
    .active{
        background: linear-gradient(-88deg,#ff4f2e,#f91f28);
        color: #fff;
        border-radius: 1rem;
    }
    }
    .title-box:nth-child(4){
        border: none;
    }
    .shop-bt-box-h{
        padding: 0 1.4rem;
        justify-content: space-between;
    
    .shop-bt-box{
      
        img{
            width: 17rem;
            height: 17rem;
        }
        .shop-desc{
            width:17rem;
              overflow: hidden;
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 2;

        }
        .shop-price{
            color:#ff534c
        }

    }
    }

    .shop-bt-box-h1{
        padding: 0 1.4rem;
        justify-content: space-between;
    
    .shop-bt-box{
      width: 36.1rem;
      display: flex;
    align-items: center;
    margin-bottom: 1rem;
        img{
            width: 17rem;
            height: 17rem;
        }
        .shop-desc{
            width:17rem;
              overflow: hidden;
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 2;

        }
        .shop-price{
            color:#ff534c
        }

    }
    }
    
}
</style>